﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="CRM.Web.MenuManage.List" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <uc:ucHead ID="ucHead1" runat="server" />
    <script type="text/javascript">
     var lineMove = false;
     var currTh = null;
     $(document).ready(function() {
         //function(event) { $(this).css({ 'cursor': '/web/Page/frameset/images/splith.cur' }
         $("body").append("<div id=\"line\" style=\"width:1px;height:200px;border-left:1px solid #00000000; position:absolute;display:none\" ></div> ");
         $("body").bind("mousemove", function(event) {
             if (lineMove == true) {
                 $("#line").css({ "left": event.clientX }).show();
             }
         });

         $("th").bind("mousemove", function(event) {
             var th = $(this);
             if (th.prevAll().length <= 1 || th.nextAll().length < 1) {
                 return;
             }
             var left = th.offset().left;
             if (event.clientX - left < 4 || (th.width() - (event.clientX - left)) < 4) {
                 th.css({ 'cursor': '/web/Page/frameset/images/splith.cur' });
             }
             else {
                 th.css({ 'cursor': 'default' });
             }
         });

         $("th").bind("mousedown", function(event) {
             var th = $(this);
             if (th.prevAll().length <= 1 | th.nextAll().length < 1) {
                 return;
             }
             var pos = th.offset();
             if (event.clientX - pos.left < 4 || (th.width() - (event.clientX - pos.left)) < 4) {
                 var height = th.parent().parent().height();
                 var top = pos.top;
                 $("#line").css({ "height": height, "top": top,"left":event .clientX,"display":"" });
                 lineMove = true;
                 if (event.clientX - pos.left < th.width() / 2) {
                     currTh = th.prev();
                 }
                 else {
                     currTh = th;
                 }
             }
         });

         $("body").bind("mouseup", function(event) {
             if (lineMove == true) {
                 $("#line").hide();
                 lineMove = false;
                 var pos = currTh.offset();
                 var index = currTh.prevAll().length;
                 currTh.width(event.clientX - pos.left);
                 currTh.parent().parent().find("tr").each(function() {
                     $(this).children().eq(index).width(event.clientX - pos.left);
                 }); //.children().eq(index).width(event.clientX - pos.left);
             }
         });
         $("th").bind("mouseup", function(event) {
             if (lineMove == true) {
                 $("#line").hide();
                 lineMove = false;
                 var pos = currTh.offset();
                 var index = currTh.prevAll().length;
                 currTh.width(event.clientX - pos.left);
                 currTh.parent().parent().find("tr").each(function() {
                     $(this).children().eq(index).width(event.clientX - pos.left);
                 });
             }
         });
     });
    </script>
</head>
<body>
    <form id="form1" runat="server"  defaultbutton="btnSearch" >
<table border="0" cellpadding="0" cellspacing="0" id="tTitle">
    <tr>
	<td class="left">
	    <img src="<%= base.ResourcesPath %>Images/title_left.gif" alt="" />
	</td>
	<td class="middle">

    <div class="pagetitle">
        <div><asp:Label ID="lblTitle" runat="server" Text="菜单列表" ></asp:Label></div>
    </div>
	
	</td>
	<td class="right">
	    <img src="<%= base.ResourcesPath %>Images/title_right.gif" alt="" />
	</td>
    </tr>
</table>
    <div id="divMain" >
    <div style="width: 100%; display: none;">
        <table border="0" cellpadding="0" cellspacing="0" class="search" align="center">
            <tr>
                <td class="title">
                    菜单编号:
                </td>
                <td class="content">
                    <asp:TextBox ID="txtMENUID" runat="server" CssClass="txt" MaxLength="8" Rows="3"
                        TextMode="SingleLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="title">
                    菜单名称:
                </td>
                <td class="content">
                    <asp:TextBox ID="txtMENUNAME" runat="server" CssClass="txt" MaxLength="128" Rows="3"
                        TextMode="SingleLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
               
            </tr>
            <tr>
                <td class="title">
                    排序顺序:
                </td>
                <td class="content">
                    <asp:TextBox ID="txtSORTODER" runat="server" CssClass="txt" MaxLength="8" Rows="3"
                        TextMode="SingleLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                
            </tr>
            <tr>
                <td class="title">
                    菜单提示:
                </td>
                <td class="content">
                    <asp:TextBox ID="txtMENUPROMPT" runat="server" CssClass="txt" MaxLength="128" Rows="3"
                        TextMode="SingleLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="title">
                    页面路径:
                </td>
                <td class="content">
                    <asp:TextBox ID="txtPAGEPATH" runat="server" CssClass="txt" MaxLength="128" Rows="3"
                        TextMode="SingleLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="title">
                    页面名称:
                </td>
                <td class="content">
                    <asp:TextBox ID="txtPAGENAME" runat="server" CssClass="txt" MaxLength="128" Rows="3"
                        TextMode="SingleLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="title">
                    菜单状态:
                </td>
                <td class="content">
                    <asp:TextBox ID="txtMENUSTATE" runat="server" CssClass="txt" MaxLength="8" Rows="3"
                        TextMode="SingleLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="title">
                    新页面目标:
                </td>
                <td class="content">
                    <asp:TextBox ID="txtMENUTARGET" runat="server" CssClass="txt" MaxLength="32" Rows="3"
                        TextMode="SingleLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="title">
                    备注:
                </td>
                <td class="content">
                    <asp:TextBox ID="txtREMARK" runat="server" CssClass="txt" MaxLength="128" Rows="3"
                        TextMode="SingleLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="title">
                    &nbsp;
                </td>
                <td class="content">
                </td>
            </tr>
        </table>
    </div>
    <div style="width: 100%">
        <div class="listdiv">
        <table border="0" cellpadding="0" cellspacing="0" class="search"  align="center">
		    <tr>
		        <td class="title"><div  class="nowrap">
                    菜单类型:</div>
                </td>
                <td class="content">
                    <asp:DropDownList ID="ddlMENUTYPE" runat="server" CssClass="ddl" ></asp:DropDownList>
                </td>
                 <td class="title"><div  class="nowrap">
                    上级菜单:</div>
                </td>
                <td class="content">
                    <asp:DropDownList ID="ddlPARENTMENUID" runat="server" CssClass="ddl">
                    </asp:DropDownList>
                </td>
                <td class="title" style="width: auto;" >&nbsp;</td>
			    <td class="content"><div style="width: 100px; " class="nowrap">
                    <asp:Button ID="btnSearch" runat="server" Text="查 询" CommandName="Search" CssClass="btn title_cx" OnClick="btnSearch_Click" />
                    </div>
                    </td>
		    </tr>
        </table>	
            <dp:WebGridView ID="gvList" runat="server" CssClass="gridview" AutoGenerateColumns="False"
                OnRowCreated="gvList_RowCreated" OnRowDataBound="gvList_RowDataBound" OnRowDeleting="gvList_RowDeleting"
                AllowPaging="True" AllowSorting="True" Width="100%" 
                SortExpressionValue="MENUID"  SortDirectionValue="DESC">
                <Columns>
                    <asp:TemplateField HeaderText="菜单编号" SortExpression="MENUID">
                        <ItemTemplate>
                                <asp:HyperLink ID="hlModifyMENUID" runat="server" NavigateUrl='<%# Eval("MENUID", ModifyUrl) %>' Text='<%# Bind("MENUID") %>'></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="菜单名称" SortExpression="MENUNAME">
                        <ItemTemplate>
                                <asp:HyperLink ID="hlModifyMENUNAME" runat="server" NavigateUrl='<%# Eval("MENUID", ModifyUrl) %>' Text='<%# Bind("MENUNAME") %>'></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="PARENTMENUID" HeaderText="上级菜单编号" 
                        SortExpression="PARENTMENUID" />
                    <asp:BoundField DataField="SORTODER" HeaderText="排序顺序" SortExpression="SORTODER" />
                    <asp:BoundField DataField="MENUTYPE" HeaderText="菜单类型" SortExpression="MENUTYPE" />
                    <asp:BoundField DataField="MENUPROMPT" HeaderText="菜单提示" SortExpression="MENUPROMPT" />
                    <asp:BoundField DataField="PAGEPATH" HeaderText="页面路径" SortExpression="PAGEPATH" />
                    <asp:BoundField DataField="PAGENAME" HeaderText="页面名称" SortExpression="PAGENAME" />
                    <asp:BoundField DataField="MENUSTATE" HeaderText="菜单状态" SortExpression="MENUSTATE" />
                    <asp:BoundField DataField="MENUTARGET" HeaderText="新页面目标" SortExpression="MENUTARGET" />
                    <asp:BoundField DataField="REMARK" HeaderText="备注" SortExpression="REMARK" />
                    <asp:TemplateField HeaderText="操作" ShowHeader="False">
                        <ItemTemplate>
                            <div style="white-space: nowrap;">
                                <asp:HyperLink ID="hlModify" runat="server" NavigateUrl='<%# Eval("MENUID", ModifyUrl) %>'>详细</asp:HyperLink>
                                <asp:LinkButton ID="lbtnDelete" runat="server" Text="删除" CommandName="Delete" CausesValidation="False"
                                    OnClientClick="return confirm('您确认要删除此条记录吗？');"></asp:LinkButton>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <RowStyle CssClass="row" />
                <AlternatingRowStyle CssClass="row2" />
                <HeaderStyle CssClass="header" />
                <PagerStyle CssClass="pager" />
            </dp:WebGridView>
        </div>
    </div>
    </div>
    </form>
</body>
</html>
